package com.edu.aspect;


import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

public class LogAspect {
    public void before(JoinPoint jt){
        System.out.println(jt.getTarget());
        System.out.println(jt.getSignature().getName());
        System.out.println("前置通知");
    }

    public void after(JoinPoint jt){
        System.out.println("后置通知");
    }

    public void afterThrow(JoinPoint jt,Throwable e){
        System.out.println(e.getClass());
        System.out.println("异常后置通知");
    }

    public void afterReturning(JoinPoint jt,Object o){
        System.out.println(o);

        System.out.println("后置返回通知");
    }

    public Object around(ProceedingJoinPoint jt) throws Throwable {
        System.out.println("执行了环绕通知");
        return jt.proceed();
    }
}
